#include <iostream>
#include <Eigen/Dense>
#include <array>
#include <vector>

using namespace Eigen;
using std::cout, std::endl;

void test_Map_array(){
    double data[] = {1.0,2,3,4,5,6};
    Eigen::Map<Eigen::Matrix<double, 2,3>> matrix(data);
    cout << "array to matrix = \n" << matrix << endl;

    Eigen::Map<Eigen::Matrix<double, 2,3, RowMajor>> matrix_row(data);
    cout << "array to matrix_row = \n" << matrix_row << endl;

    Eigen::Map<Eigen::Array<double,1,6>> arr(data); // 1d Array
    Eigen::Map<Eigen::Array<double,2,3>> arr2(data); // 2d Array
    cout << "array to 1d Array: " <<  arr << endl;
    cout << "array to 2d Array: \n" << arr2 << endl;
}

void test_Map_std_array(){
    std::array<double, 6> data = {1.0,2,3,4,5,6};
    Eigen::Map<Eigen::Matrix<double, 2,3>> matrix(data.data());
    cout << "std::array to matrix = \n" << matrix << endl;

    Eigen::Map<Eigen::Matrix<double, 2,3, RowMajor>> matrix_row(data.data());
    cout << "std::array to matrix_row = \n" << matrix_row << endl;

    Eigen::Map<Eigen::Array<double,1,6>> arr(data.data()); // 1d Array
    Eigen::Map<Eigen::Array<double,2,3>> arr2(data.data()); // 2d Array
    cout << "std array to 1d Array: " <<  arr << endl;
    cout << "std array to 2d Array: \n" << arr2 << endl;
}

void test_Map_std_vector(){

}



int main(){
    test_Map_array();
    test_Map_std_array();
    test_Map_std_vector();
    return 0;
}